# coding=utf-8
from resource_management import *
from resource_management.core.logger import Logger
from resource_management.libraries.functions import format
from resource_management.libraries.functions.check_process_status import check_process_status


class Client(Script):
    def install(self, env):
        import params
        env.set_params(params)
        print "Master install method"
        # Install packages listed in metainfo.xml
        # self.install_packages(env)
        print "aimport config:", params.log_file, params.war_url, params.servlet_server_tar_url
        Logger.info("this is logger print message")
        # Logger.error("this is logger  print message,the level is error")
        # Logger.warning("this is logger print message,the level is warning")
        # Logger.debug("this is logger print message,the level is debug")
        Logger.info(format("ddse config-logfile is:{log_file}"))

    # To get status of the, use the linux service status command
    def status(self, env):
        import status_params
        env.set_params(status_params)
        check_process_status(status_params.webapp_pid)


if __name__ == "__main__":
    Client().execute()
